We are interested in particular protein signaling activity that might give rise to specific immune phonetypes.
##now how do we bracket them?
##plot correlation distributions by cell type and method.
require(ggplot2)
p<-ggplot(corVals)+geom_boxplot(aes(x=cell_type,y=corVal,fill=method))+ theme(axis.text.x = element_text(angle = 45, hjust = 1))+ggtitle("Correlation of MultiPLIER Latent Variables with predicted cell type")
print(p)
There are some latent variables that show up as highly correlated. By choosing a threshold, we can evaluate what they are in more detail.
corthresh=0.6
##now filter to the cell types with correlated latent variables (or anticorrelated)
cor_cell_types=subset(corVals,abs(corVal)>corthresh)%>%
ungroup()%>%
group_by(latent_var)%>%
mutate(numTypes=n_distinct(cell_type))%>%
subset(numTypes>1)%>%
mutate(cell_types=paste(unique(cell_type),collapse=','))%>%
ungroup()%>%
select(latent_var,method,cell_types)%>%unique()
print(paste('we found',nrow(cor_cell_types),'latent variables/methods with some cell types with correlation greater than',corthresh))
## [1] "we found 84 latent variables/methods with some cell types with correlation greater than 0.6"
DT::datatable(cor_cell_types)